package com.cloud.pikachu.dingtalk.controller;

import com.cloud.pikachu.dingtalk.service.login.AvoidLoginService;
import com.cloud.pikachu.dingtalk.service.login.UserInfoModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/avoidlogin")
public class AvoidLoginController {

    @Autowired
    private AvoidLoginService avoidLoginService;

    /**
     *
     * @param code 授权 code值
     * //@Cacheable(value = "avoidLogin", key = "#code") //暂不使用请求缓存
     * @return
     */
    @GetMapping("/code/{code}")
    public UserInfoModel avoidLogin(@PathVariable String code){
        UserInfoModel userInfoModel = avoidLoginService.avoidLogin(code);
        return userInfoModel;
    }

}
